package com.ruoyi.web.controller.system;

import java.util.List;
import java.util.Map;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.system.service.IDashboardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;


/**
 * 首页数据 控制器
 */
@RestController
@RequestMapping("/system/dashboard")
public class DashboardController extends BaseController {
    @Autowired
    private IDashboardService dashboardService;

    /**
     * 获取统计数据
     */
    @GetMapping("/statistics")
    public AjaxResult getStatistics() {
        Map<String, Object> data = dashboardService.getStatistics();
        return AjaxResult.success(data);
    }

    /**
     * 获取最新投诉建议
     */
    @GetMapping("/latest-complaints")
    public AjaxResult getLatestComplaints() {
        List<Map<String, Object>> complaints = dashboardService.getLatestComplaints();
        return AjaxResult.success(complaints);
    }

    /**
     * 获取最新访客记录
     */
    @GetMapping("/latest-visitors")
    public AjaxResult getLatestVisitors() {
        List<Map<String, Object>> visitors = dashboardService.getLatestVisitors();
        return AjaxResult.success(visitors);
    }
}